var rootview = ui("$");
var helperOpen = require("helper/open");
var alImg01 = ui("alImg01");
var alImg02 = ui("alImg02");
var alImg03 = ui("alImg03");
var aLayout0 = ui("do_ALayout_3");
var aLayout1 = ui("do_ALayout_4");
var aLayout2 = ui("do_ALayout_5");
var aLayoutTitle = ui("aLayoutTitle");
var aLayoutMore = ui("do_ALayout_more");
rootview.setMapping({
	"aLayoutTitle.tag" : "localSpList"
});

rootview.on("dataRefreshed", function() {
	var allData = JSON.parse(aLayoutTitle.tag);
	alImg01.source = allData[0].pathSubjectImg1;
	alImg02.source = allData[1].pathSubjectImg1;
	alImg03.source = allData[2].pathSubjectImg1;
});

/*var mall01Title = ui("borderViewTitle");
var mall01ChildTitle = mall01Title.getView("center")
var mall01CenterTitle = ui(mall01ChildTitle);
var mall01Tag = {name:"桃源居商家供应",color:"ff5400FF",bgimg1:"source://image/mall/tit01.png",bgimg2:"source://image/mall/tit02.png"};
mall01CenterTitle.fire(mall01ChildTitle, {"tag":mall01Tag,"borderView":mall01Title.getAddress()});
*/
aLayout0.on("touch", function(data){
	 openPage(0);
});
aLayout1.on("touch", function(data){
	openPage(1);
});
aLayout2.on("touch", function(data){
	openPage(2);
});

function openPage(n){
	var allData = JSON.parse(aLayoutTitle.tag);
	helperOpen.open("source://view/mall/search/mallSearch.ui",{supplierId:allData[n].id});
}

aLayoutMore.on("touch", function(data){
	helperOpen.open("source://view/mall/search/supplierSearch.ui",{type:2});
});